package cn.hsw.platform.core.util;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;

/**
 * maputil的扩展
 * @author 李子木
 */
public class MapUtil extends cn.hutool.core.map.MapUtil {
    public static <T> Map<String, Object> of(T t) throws IllegalAccessException {

        Map<String, Object> result = MapUtil.newHashMap();
        Field[] fields=t.getClass().getDeclaredFields();
        for (Field field:fields){
            field.setAccessible(true);
            result.put(field.getName(),field.get(t));
        }
        return result;
    }
}
